#include <stdio.h>

int calc(int n)
{
    int r;
    for (r=0; n>0; n/=10)
        r += n%10;
    return r;
}

int main()
{
    int n;
    while (~scanf("%d",&n)&&n)
        printf("%d %d\n",calc(n),calc(n*n));
}
